package com.maskiner.smc.util;

import java.sql.*;

import javax.sql.*;
import javax.naming.*;

public class MySqlDbConn {

	
	public static Connection obtenerConexion() 
					throws NamingException {
		Connection conexion=null;
		
			try {
				Context ctx= new InitialContext();
				String nombreDelContextJNDI="java:comp/env/";
				DataSource	ds=
					(DataSource)ctx.lookup(
							nombreDelContextJNDI+"jdbc/sisepuede");
				
				conexion=ds.getConnection();
			
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		return conexion;
	}
	
public static Connection getConMaskiner()throws NamingException {
Connection conexion=null;

try {
Context ctx= new InitialContext();
String nombreDelContextJNDI="java:comp/env/";
DataSource	ds=
	(DataSource)ctx.lookup(
			nombreDelContextJNDI+"jdbc/maskiner");

conexion=ds.getConnection();

} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return conexion;
}
	
	
	
}
